package pri.zxx.learndemo.threademo.base;

import lombok.extern.slf4j.Slf4j;
import pri.zxx.webdemo.utils.TimeUtils;

import java.util.concurrent.TimeUnit;

/**
 * @author Twilight
 * @desc
 * @createTime 2020-06-26-12:50
 */
@Slf4j
public class InterruptDemo {
    public static void main(String[] args) {

        Thread testThread = new Thread(() -> {
            try {
                TimeUnit.SECONDS.sleep(20);
            } catch (InterruptedException e) {
                System.out.println(Thread.interrupted()+"");
                e.printStackTrace();
            }

//            TimeUtils.pause(0, 20, 0);
            System.out.println(Thread.currentThread().getName() + "::执行完成");
        }, "interrupte--");
        testThread.start();
        TimeUtils.pause(0, 2, 0);
        testThread.interrupt();
//        TimeUtils.pause(3, 0, 0);

    }
}
